package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.CustomerGroupDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.customergroup.vo.*;

/**
 * 客户组管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CustomerGroupMapper extends BaseMapperX<CustomerGroupDO> {

    default PageResult<CustomerGroupDO> selectPage(CustomerGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerGroupDO>()
                .eqIfPresent(CustomerGroupDO::getGroupCode, reqVO.getGroupCode())
                .likeIfPresent(CustomerGroupDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(CustomerGroupDO::getDisabled, reqVO.getDisabled())
                .eqIfPresent(CustomerGroupDO::getBrandCode, reqVO.getBrandCode())
                .eqIfPresent(CustomerGroupDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(CustomerGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerGroupDO::getId));
    }

}